package com.ttdc.service;

import java.util.List;

import org.junit.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import com.ttdc.mapper.OrderDetailsMapper;
import com.ttdc.pojo.OrderDetails;
import com.ttdc.pojo.OrderDetailsExample;
@Service
public class OrderDetailsServiceImpl implements OrderDetailsService {

	@Autowired
	private OrderDetailsMapper orderDetailsMapper;
	private OrderDetailsExample odexample;
	private ApplicationContext applicationContext;
	@Before
	public void setUp() throws Exception{
		applicationContext = new ClassPathXmlApplicationContext("classpath:springmvc.xml");
		orderDetailsMapper=(OrderDetailsMapper) applicationContext.getBean("orderDetailsMapper");
		odexample=new OrderDetailsExample();
	}
	@Override
	public int countByExample(OrderDetailsExample example) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.countByExample(odexample);
	}

	@Override
	public int deleteByExample(OrderDetailsExample example) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.deleteByExample(odexample);
	}

	@Override
	public int deleteByPrimaryKey(Integer odId) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.deleteByPrimaryKey(odId);
	}

	@Override
	public int insert(OrderDetails record) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.insert(record);
	}

	@Override
	public int insertSelective(OrderDetails record) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.insertSelective(record);
	}

	@Override
	public List<OrderDetails> selectByExample(OrderDetailsExample example) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.selectByExample(odexample);
	}

	@Override
	public OrderDetails selectByPrimaryKey(Integer odId) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.selectByPrimaryKey(odId);
	}

	@Override
	public int updateByExampleSelective(OrderDetails record, OrderDetailsExample example) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.updateByExampleSelective(record, odexample);
	}

	@Override
	public int updateByExample(OrderDetails record, OrderDetailsExample example) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.updateByExample(record, odexample);
	}

	@Override
	public int updateByPrimaryKeySelective(OrderDetails record) {
		// TODO Auto-generated method stub
		return orderDetailsMapper.updateByExampleSelective(record, odexample);
	}

	@Override
	public int updateByPrimaryKey(OrderDetails record) {
		// TODO Auto-generated method stub
		System.out.println(record);
		return orderDetailsMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<OrderDetails> selectByAll() {
		// TODO Auto-generated method stub
		return orderDetailsMapper.selectByAll();
	}

}
